package com.isoft.entity;

import jakarta.persistence.*;
import lombok.Data;
import org.hibernate.annotations.Type;
import java.time.LocalDateTime;

@Entity
@Table(name = "flight_change_request")
@Data
public class FlightChangeRequest {
    @Id
    @Column(name = "request_id", length = 36)
    private String requestId;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "flight_id", nullable = false)
    private FlightInfo flight;

    @Column(name = "requester_id", length = 50, nullable = false)
    private String requesterId;

    @Column(name = "request_time", nullable = false)
    private LocalDateTime requestTime;

    @Column(name = "change_type", length = 30, nullable = false)
    private String changeType; // 如: TIME_CHANGE, ROUTE_CHANGE, STATUS_CHANGE

//    @Type(type = "org.hibernate.type.TextType")
    @Column(name = "original_info")
    private String originalInfo; // JSON格式的原始信息

//    @Type(type = "org.hibernate.type.TextType")
    @Column(name = "requested_info")
    private String requestedInfo; // JSON格式的请求变更信息

    @Column(name = "status", length = 20, nullable = false)
    private String status; // 如: PENDING, APPROVED, REJECTED, CANCELLED

//    @Type(type = "org.hibernate.type.TextType")
    @Column(name = "reason")
    private String reason;
}